package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ChatGroupMemberMapper;
import com.ruoyi.system.domain.ChatGroupMember;
import com.ruoyi.system.service.IChatGroupMemberService;

/**
 * 群成员Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-30
 */
@Service
public class ChatGroupMemberServiceImpl implements IChatGroupMemberService 
{
    @Autowired
    private ChatGroupMemberMapper chatGroupMemberMapper;

    /**
     * 查询群成员
     * 
     * @param id 群成员主键
     * @return 群成员
     */
    @Override
    public ChatGroupMember selectChatGroupMemberById(Long id)
    {
        return chatGroupMemberMapper.selectChatGroupMemberById(id);
    }

    /**
     * 查询群成员列表
     * 
     * @param chatGroupMember 群成员
     * @return 群成员
     */
    @Override
    public List<ChatGroupMember> selectChatGroupMemberList(ChatGroupMember chatGroupMember)
    {
        return chatGroupMemberMapper.selectChatGroupMemberList(chatGroupMember);
    }

    /**
     * 新增群成员
     * 
     * @param chatGroupMember 群成员
     * @return 结果
     */
    @Override
    public int insertChatGroupMember(ChatGroupMember chatGroupMember)
    {
        chatGroupMember.setCreateTime(DateUtils.getNowDate());
        return chatGroupMemberMapper.insertChatGroupMember(chatGroupMember);
    }

    /**
     * 修改群成员
     * 
     * @param chatGroupMember 群成员
     * @return 结果
     */
    @Override
    public int updateChatGroupMember(ChatGroupMember chatGroupMember)
    {
        chatGroupMember.setUpdateTime(DateUtils.getNowDate());
        return chatGroupMemberMapper.updateChatGroupMember(chatGroupMember);
    }

    /**
     * 批量删除群成员
     * 
     * @param ids 需要删除的群成员主键
     * @return 结果
     */
    @Override
    public int deleteChatGroupMemberByIds(Long[] ids)
    {
        return chatGroupMemberMapper.deleteChatGroupMemberByIds(ids);
    }

    /**
     * 删除群成员信息
     * 
     * @param id 群成员主键
     * @return 结果
     */
    @Override
    public int deleteChatGroupMemberById(Long id)
    {
        return chatGroupMemberMapper.deleteChatGroupMemberById(id);
    }
}
